package com.claimSettlement.controller;

import com.claimSettlement.pojo.Case;
import com.claimSettlement.pojo.Worker;
import com.claimSettlement.service.CaseOpenFeginService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/user")
public class DangerController {
    @Resource
    private CaseOpenFeginService caseOpenFeginService;

    @RequestMapping("/case/getCaseAll")
    PageInfo<Case> getCaseAll(int page){
        return caseOpenFeginService.getCaseAll(page);
    }

    @RequestMapping(value = "/case/insertCase",method = RequestMethod.POST,produces = "application/json;charset=UTF-8")
    int insertCase(@RequestBody Case cases){
        return caseOpenFeginService.insertCase(cases);
    }

    @RequestMapping("/case/updCaseHandling")
    int updCaseHandling(int caseHandling,int caseState,String caseId){
        return caseOpenFeginService.updCaseHandling(caseHandling, caseState, caseId);
    }

    @RequestMapping("/case/insertWorker")
    int insertWorker(String caseId,int userId,String dispatchedWorkerEndTime){
        return caseOpenFeginService.insertWorker(caseId, userId,dispatchedWorkerEndTime);
    }

    @RequestMapping("/getCaseByUserId")
    public PageInfo<Case> getCaseByUserId(int userId,int shuzhi,int inbh,int endtime,int page){
        return caseOpenFeginService.getCaseByUserId(userId,shuzhi,inbh,endtime,page);
    }

    @RequestMapping("/getCaseBycaseId")
    Case getCaseBycaseId(String caseId){
        return caseOpenFeginService.getCaseBycaseId(caseId);
    }

    @RequestMapping("/case/getCaseOne")
    public Case getCaseOne(String caseId) {
        return caseOpenFeginService.getCaseOne(caseId);
    }

    @RequestMapping("/case/getCaseId")
    public PageInfo<Case> getCaseId(String caseId, String recognizeeName, String plateNumber,int page) {
        return caseOpenFeginService.getCaseId(caseId, recognizeeName, plateNumber, page);
    }

    @RequestMapping(value = "/case/updateCase",method = RequestMethod.POST,produces = "application/json;charset=UTF-8")
    public int updateCase(@RequestBody Case cases) {
        return caseOpenFeginService.updateCase(cases);
    }

    @RequestMapping("/case/getCaseChul")
    public PageInfo<Case> getCaseChul(int page){
        return caseOpenFeginService.getCaseChul(page);
    }

    @RequestMapping("/case/getWorkerAll")
    public List<Worker> getWorkerAll(){
        return caseOpenFeginService.getWorkerAll();
    }

    @RequestMapping("/getSurveyCountCaseId")
    public String getSurveyCountCaseId(String caseId) {
        return caseOpenFeginService.getSurveyCountCaseId(caseId);
    }

    @RequestMapping("/case/getCaseCount")
    public int getCaseCount(String recognizeeId, String plateNumber) {
        return caseOpenFeginService.getCaseCount(recognizeeId, plateNumber);
    }
}
